package com.mall.vo;

import lombok.Data;
import java.time.LocalDateTime;

/**
 * 用户信息VO
 * 
 * @author Mall Team
 */
@Data
public class UserInfoVO {
    
    private Long id;
    private String username;
    private String phone;
    private String email;
    private String nickname;
    private String avatar;
    private Integer userType;
    private String userTypeDesc;
    private Integer status;
    private String statusDesc;
    private LocalDateTime createTime;
    
    /**
     * 登录响应VO
     */
    @Data
    public static class LoginVO {
        private String token;
        private UserInfoVO userInfo;
        
        public LoginVO(String token, UserInfoVO userInfo) {
            this.token = token;
            this.userInfo = userInfo;
        }
    }
    
    /**
     * 设置用户类型描述
     */
    public void setUserTypeDesc() {
        if (this.userType != null) {
            switch (this.userType) {
                case 1:
                    this.userTypeDesc = "普通用户";
                    break;
                case 2:
                    this.userTypeDesc = "商家";
                    break;
                case 3:
                    this.userTypeDesc = "管理员";
                    break;
                default:
                    this.userTypeDesc = "未知";
                    break;
            }
        }
    }
    
    /**
     * 设置状态描述
     */
    public void setStatusDesc() {
        if (this.status != null) {
            this.statusDesc = this.status == 1 ? "正常" : "禁用";
        }
    }
}